package core.database.pojo.entity;

import core.utils.IPUtil;

import java.sql.Connection;
import java.sql.SQLException;


/**
 * @author Long
 * @version 1.0
 * @description:
 * @title IConnection
 * @date 2021/3/6 9:24
 */

public class IConnection {
    private Connection con;
    private String ip;
    private long createTime;

    public IConnection(Connection con) {
        this.con = con;
        this.ip = IPUtil.getServerIp();
        this.createTime = System.currentTimeMillis();
    }

    public Connection getCon() {
        if (con == null) {
            // TODO
        }
        return con;
    }

    public void close(){
        try {
            this.con.close();
        } catch (SQLException throwables) {
            System.out.println("连接关闭异常");
        }
    }
}
